
<div class="main-body">

					<div class='panel'>
						<div class='header'>
							<span class='col_fade'>所有文章分类</span>
						</div>
						<div class='inner'>
							<% if(categories && categories.length > 0 ){ %>
							<table class='table'>
								<thead>
									<th width=60px>序号</th>
									<th width=120px>名字</th>
									<th width=100px>编辑</th>
									<th width=100px>删除</th>
								</thead>
								<tbody>
								<%- partial('category/category_can_edit',{collection:categories,as:'category'}) %>
								</tbody>
							</table>
							<% }else{ %>
							<p>无分类</p>
							<% } %>
						</div>
					</div>
		
					<div class='panel'>
						<div class='header'>
							<span class='col_fade'>添加文章分类</span>
						</div>
						<div class='inner'>
							<% if(locals.edit_error){ %>
							<div class="alert alert-error">	
								<a class="close" data-dismiss="alert" href="#">&times;</a>
								<strong><%= edit_error %></strong>
							</div>
							<% } %>
							<form id='add_tag_form' class='form-horizontal' action='/category/add' method='post'>
								<div class='control-group'>
									<label class='control-label' for='name'>名字</label>
									<div class='controls'>
										<input class='input-xlarge' id='name' name='name' size='30' type='text' />
										<p class='help-block'>须为汉字和字母和数字组合</p>
									</div>
								</div>
								<div class='control-group'>
									<label class='control-label' for='sequence'>序号</label>
									<div class='controls'>
									<select class='span2' name='sequence'>
									<% if(categories && categories.length >= 0 ){ %>
									<% for(var i=0; i<=categories.length; i++){ %>
									<% if(i != categories.length){ %>
									<option value='<%= i+1 %>'><%= i+1 %></option>
									<% }else{ %>
									<option value='<%= i+1 %>' selected='selected'><%= i+1 %></option>
									<% } %>
									<% } %>
									<% } %>
									</select>
									<p class='help-block'>首页标签按此序号由小到大排序</p>
									</div>
								</div>
								<input type='hidden' name='_csrf' value='<%= csrf %>' />
								<div class='control-group'>
									<label class='control-label'></label>
									<div class='controls'>
										<input type='submit' class='btn' value='添加' />
									</div>
								</div>
								
							</form>
						</div>
					</div>
		
	
					<script type='text/javascript'>
						$(document).ready(function(){
							$('.delete_category_btn').click(function(){
								if(confirm('确定要删除此文章分类吗？')){
									window.location.href = $(this).attr('href');
								}
								return false;
							});
						});
					</script>
	

</div>
<%-partial('user/profile',{object:locals.current_user.id, as:'user_id'})%>
